package com.zdlog.ler.controller;

import com.zdlog.ler.Resp.object.ResponeMessage;
import com.zdlog.ler.Resp.util.ResponeMessageUtil;
import com.zdlog.ler.entity.LerUser;
import com.zdlog.ler.service.LerProvinceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: ler-fast
 * @description:
 * @author: tengxianchao
 * @email: admin@zdlog.com
 * @create: 2018-11-22 17:14
 **/
@RestController
@RequestMapping("/city")
@Slf4j
public class LerProvinceController {


    @Autowired
    private LerProvinceService lerProvinceService;


    @GetMapping("/province")
    public ResponeMessage province() {
        return ResponeMessageUtil.success(lerProvinceService.findByProvince());
    }


    @GetMapping("/city")
    public ResponeMessage city(@RequestParam("provinceCode") String provinceCode) {
        return ResponeMessageUtil.success(lerProvinceService.findByCity(provinceCode));
    }



    @GetMapping("/county")
    public ResponeMessage county(@RequestParam("cityCode") String cityCode) {
        return ResponeMessageUtil.success(lerProvinceService.findByCityCode(cityCode));
    }




}
